<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * gfToolkit provides basic utility methods.
 *
 * @author batanayi
 */
class gfToolkit extends sfToolkit
{

    /**
     * Returns a variable for dubuggin purposes string
     */
    public static function debug($data)
    {
        echo "<pre>";
        if (is_object($data) || is_array($data))
        {
            print_r($data);
        }
        else
        {
            echo $data;
        }
        die("</pre>");
    }

    /**
     * Returns a formatted string
     */
    public static function format($number, $decimal = 0)
    {
        return number_format($number, $decimal, '.', ',');
    }

    /**
     * Returns a random string
     */
    public static function random($length = 8)
    {
        $val = '';
        $values = 'abcdefghijklmnopqrstuvwxyz0123456789';
        for ($i = 0; $i < $length; $i++)
        {
            $val .= $values[rand(0, 35)];
        }

        return $val;
    }

}

?>
